<?php

class ReviewController extends AdminController
{

    public function actionIndex()
    {	
	$page = Yii::app()->request->getParam('page', 1);

	$pager = new CPagination(FactoryService::get('review')->getCount());
	$pager->setPageSize(Yii::app()->params['perPage']);

	$modelList = FactoryService::get('review')->getReviewList(array(), $page, $pager->getLimit());

	$this->render('index', array('models' => $modelList, 'pager' => $pager, 'page' => $page));
    }

    public function actionRemove()
    {
	$id = Yii::app()->getRequest()->getParam('id');
	if (!$id) {
	    $this->redirect(Yii::app()->getRequest()->getUrlReferrer());
	}
	$model = FactoryService::get('review')->get($id);
	if ($model) {	    
	    FactoryService::get('review')->remove($model);
	}
	$this->redirect(Yii::app()->getRequest()->getUrlReferrer());
    }

}